package online.lmds.sdmanage.main.device.service;

import online.lmds.sdmanage.common.Status;
import online.lmds.sdmanage.common.entity.Result;
import online.lmds.sdmanage.main.device.dao.RunLogDao;
import online.lmds.sdmanage.main.device.entity.RunLog;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;

import java.util.Date;
import java.util.List;

/**
 * Created by Brighten Ma on 2017/5/29.
 */

@Service("RunLogService")
public class RunLogServiceImpl implements RunLogService {

    @Resource(name = "RunLogDao")
    private RunLogDao runLogDao;


    @Override
    public Result listBetweenDate(RunLog runLog, Date start, Date end) {

        Result result = new Result();
        if (runLog == null || runLog.getDeviceUid()== null) {
            return result.setErrorCode().setMessage("数据异常").setStatus(Status.BASE_ID_ERROR);
        }

        List<RunLog> getList = runLogDao.listBetweenDate(runLog, start, end);
        return result.setSuccessCode().setStatus(Status.SUCCEED).setData(getList);
    }

}
